find_package(PkgConfig)
pkg_check_modules(PC_GTEST  gtest)

find_path(GTEST_INCLUDE_DIRS
    NAMES gtest/gtest.h
    HINTS ${PC_GTEST_INCLUDEDIR}
    ${PC_GTEST_INCLUDE_DIRS}
)

find_library(GTEST_LIBRARIES
    NAMES gtest
    HINTS ${PC_GTEST_LIBDIR}
    ${PC_GTEST_LIBRARY_DIRS}
)

if(GTEST_INCLUDE_DIRS AND GTEST_LIBRARIES)
    set(GTEST_FOUND TRUE)
    set(GTEST_LIBRARY ${GTEST_LIBRARIES})
    set(GTEST_INCLUDE_DIR ${GTEST_INCLUDE_DIRS})
    set(GTEST_VERSION ${PC_GTEST_VERSION})
endif()

include(FindPackageHandleStandardArgs)
#FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTEST REQUIRED_VARS GTEST_INCLUDE_DIRS GTEST_LIBRARIES 
#	FOUND_VAR GTEST_FOUND VERSION_VAR GTEST_VERSION)

mark_as_advanced(GTEST_LIBRARIES GTEST_LIBRARY GTEST_INCLUDE_DIRS GTEST_INCLUDE_DIR GTEST_FOUND GTEST_VERSION)

